package com.itheima.reggie.utils;

/**
 * ThreadLocal工具类
 * 用来存储当前线程的信息
 */
public class BaseContext {

    //定义全局变量
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置信息
     * @param id
     */
    public static void set(Long id) {
        threadLocal.set(id);
    }

    /**
     * 获取信息
     * @return
     */
    public static Long get() {
        return threadLocal.get();
    }
}
